<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        do {
            var choose = prompt('欢迎使用简易计算器:\n1.加法运算\n2.减法运算\n3.乘法运算\n4.除法运算\n5.退出\n请输入您的选项');
            if (choose < 5 && choose > 0) {
                var a = prompt('请输入一个值');
                var b = prompt('再输入第二个值');
                var result = 0;
            }
            switch (choose) {
                case '1':
                    result = parseFloat(a) + parseFloat(b);
                    alert('结果为' + result);
                    break;
                case '2':
                    result = a - b;
                    alert('结果为' + result);
                    break;
                case '3':
                    result = a * b;
                    alert('结果为' + result);
                    break;
                case '4':
                    result = a / b;
                    alert('结果为' + result);
                    break;
            }
        } while (choose != 5)
        alert('正在退出...')
    </script>
</head>

<body>

</body>

</html>